<?php

declare(strict_types=1);

namespace app\service\dto;

/**
 * 错误结果类
 */
class ErrorResult implements ResultInterface
{
    private int $code;
    private string $message;
    private array $data;

    public function __construct(string $message = '操作失败', int $code = 400, array $data = [])
    {
        $this->message = $message;
        $this->code = $code;
        $this->data = $data;
    }

    public function isSuccess(): bool
    {
        return false;
    }

    public function getCode(): int
    {
        return $this->code;
    }

    public function getMessage(): string
    {
        return $this->message;
    }

    public function getData(): array
    {
        return $this->data;
    }
}